import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/page/modulePage/model/module_data.dart';
import 'package:boss/ui/widget/image/base_image.dart';
import 'package:flutter/material.dart';
import 'package:hi_common/hi_common.dart';

class ModuleGridItem extends StatelessWidget {
  final VoidCallback onTap;
  final Module data;
  final double iconSize;

  const ModuleGridItem(
    this.data, {
    this.onTap,
    this.iconSize,
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final iconSize = this.iconSize ?? 90.w;

    return GestureDetector(
      onTap: onTap,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          BaseImage(data.icon, width: iconSize, height: iconSize),
          Container(
            margin: EdgeInsets.only(top: 5.w),
            child: Text(data.title, style: TextStyleConstant().normal_1_22),
          ),
        ],
      ),
    );
  }
}
